﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="net.sycu.guomy.ems.entity.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%//标记库指令  %>


<!DOCTYPE HTML>
<html>
<head>
<title>登录权限审批</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="Novus Admin Panel Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, 
SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Bootstrap Core CSS -->
<link href="/EMS/css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="/EMS/css/style.css" rel='stylesheet' type='text/css' />//
<!-- font CSS -->
<!-- font-awesome icons -->
<link href="/EMS/css/font-awesome.css" rel="stylesheet">
<!-- //font-awesome icons -->
<!-- js-->
<script src="/EMS/js/jquery-1.11.1.min.js"></script>
<script src="/EMS/js/modernizr.custom.js"></script>
<!--webfonts-->
<link href='/EMS/css/123.css' rel='stylesheet' type='text/css'>
<!--//webfonts-->
<!--animate-->
<link href="/EMS/css/animate.css" rel="stylesheet" type="text/css"
	media="all">
<script src="/EMS/js/wow.min.js"></script>
<script>
		 new WOW().init();
	</script>
<!--//end-animate-->
<!-- chart -->
<script src="/EMS/js/Chart.js"></script>
<!-- //chart -->
<!--Calender-->
<link rel="stylesheet" href="/EMS/css/clndr.css" type="text/css" />
<script src="/EMS/js/underscore-min.js" type="text/javascript"></script>
<script src="/EMS/js/moment-2.2.1.js" type="text/javascript"></script>
<script src="/EMS/js/clndr.js" type="text/javascript"></script>
<script src="/EMS/js/site.js" type="text/javascript"></script>
<!--End Calender-->


<!-- Metis Menu -->
<script src="/EMS/js/metisMenu.min.js"></script>
<script src="/EMS/js/custom.js"></script>
<link href="/EMS/css/custom.css" rel="stylesheet">
<!--//Metis Menu -->
</head>
<body onload="myLoad()" class="cbp-spmenu-push">

	<%@include file="/header.jsp"%>


	<!-- Main content starts -->

	<%@include file="/admin/adminSidebar.jsp"%>

	<div id="page-wrapper">
		<div class="main-page">
			<div class="tables">
				<h3 class="title1">部门信息管理</h3>
 <form class="form-horizontal" role="form" id="frmLogin"
        action="/EMS/admin/ApproveLoginServlet" method="post" >
							  <input type="hidden" id="hidOperateType" name="hidOperateType" value="" />
            <input type="hidden" id="hidLoginId" name="hidLoginId" 
              value="${requestScope.ModifyLogin.loginId}" />
            <input type="hidden" id="hidLoginTypeId" name="hidLoginTypeId" value="" />
            <input type="hidden" id="hidLoginStateId" name="hidLoginStateId" value="" />
            <input type="hidden" id="hidDepartmentId" name="hidDepartmentId" value="" />
            <input type="hidden" id="hidCurrentPageIndex" name="hidCurrentPageIndex" 
              value="${currentPageIndex}" />
            <input type="hidden" id="hidSortField" name="hidSortField" value="${sortField}" />
            <input type="hidden" id="hidSortString" name="hidSortString" value="${sortString}" />
            <input type="hidden" id="hidPageSize" name="hidPageSize" value="${pageSize}" />
                	
                
                	
                	
				<div class="form-three widget-shadow " >
					<h4 class="title1">查询登录信息</h4>

                    
					<div data-example-id="form-validation-states" >
						
							<div class="form-group has-success">
								 
									<label class="control-label" for="inputSuccess1">登录名</label> 
									 <input type="text" class="form-control" id="txtSearchLoginName" name="txtSearchLoginName" 
                          placeholder="登录名" value="${searcher.loginName}">
                        <span class="label label-danger" id="spanSearch"></span>

							</div>
							
							<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">Email</label> 
									  <input type="text" class="form-control" id="txtSearchEmail" name="txtSearchEmail" 
                          placeholder="Email" value="${searcher.email}">
                      

							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">备注</label> 
									<textarea class="form-control" rows="3" id="txtSearchRemark" name="txtSearchRemark" 
                          placeholder="备注">${searcher.remark}</textarea>
                      </div>
                      

							</div>
							<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">登录次数</label> 
									   <input type="text" class="form-control" id="txtSearchLoginTimeMin" name="txtSearchLoginTimeMin" 
                          placeholder="登录次数" value="${searcher.loginTimeMin }">
                       <input type="text" class="form-control" id="txtSearchLoginTimeMax" name="txtSearchLoginTimeMax" 
                          placeholder="登录次数" value="${searcher.loginTimeMax }">

							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">等级</label> 
									 <input type="text" class="form-control" id="txtSearchGradeMin" name="txtSearchGradeMin" 
                          placeholder="等级" value="${searcher.gradeMin }">
                      

							</div>
							
							<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">注册时间</label> 
									    <input type="text" class="form-control" id="txtSearchRegisterDateTimeBegin" name="txtSearchRegisterDateTimeBegin" 
                          placeholder="开始时间" value="${searcher.registerDateTimeBegin }">
                       <input type="text" class="form-control" id="txtSearchRegisterDateTimeEnd" name="txtSearchRegisterDateTimeEnd" 
                          placeholder="结束时间" value="${searcher.registerDateTimeEnd }">

							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">注册IP</label> 
									  <input type="text" class="form-control" id="txtSearchRegisterIp" name="txtSearchRegisterIp" 
                          placeholder="注册IP" value="${searcher.registerIp}">
                      

							</div>
							<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">最后登录时间</label> 
							<input type="text" class="form-control" id="txtSearchLastLoginDateTimeBegin" name="txtSearchLastLoginDateTimeBegin" 
                          placeholder="开始时间" value="${searcher.lastLoginDateTimeBegin }">
                       <input type="text" class="form-control" id="txtSearchLastLoginDateTimeEnd" name="txtSearchLastLoginDateTimeEnd" 
                          placeholder="结束时间" value="${searcher.lastLoginDateTimeEnd }">

							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">最后登录IP</label> 
									  <input type="text" class="form-control" id="txtSearchLastLoginIp" name="txtSearchLastLoginIp" 
                          placeholder="最后登录IP" value="${searcher.lastLoginIp}">

							</div>
							<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">登录类型</label> 
							 <select class="form-control" id="selSearchTypeId" name="selSearchTypeId">
                          <option value="">-请选择-</option>
                          <c:forEach items="${loginTypes}" var="loginType">
                          <option value="${loginType.loginTypeId}" 
                            <c:if test="${loginType.loginTypeId == searcher.typeId}">selected="selected"</c:if>>${loginType.loginTypeName}</option>
                          </c:forEach>
                        </select>
							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">登录状态</label> 
									  <select class="form-control" id="selSearchStateId" name="selSearchStateId">
                          <option value="">-请选择-</option>
                          <c:forEach items="${loginStates}" var="loginState">
                          <option value="${loginState.loginStateId}" 
                            <c:if test="${loginState.loginStateId == searcher.stateId}">selected="selected"</c:if>>${loginState.loginStateName}</option>
                          </c:forEach>
                        </select>

							</div>
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">所属部门</label> 
									  <select class="form-control" id="selSearchDepartmentId" name="selSearchDepartmentId">
                          <option value="">-请选择部门-</option>
                          <c:forEach items="${departments}" var="department">
                            <option value="${department.departmentId}" 
                              <c:if test="${ department.departmentId == searcher.departmentId}">selected="selected"</c:if>>${department.departmentName}</option>
                          </c:forEach>
                        </select>

							</div>
							<div class="form-group">
                      <div class="col-lg-offset-1 col-lg-9">
	                      
	                      <c:if test="${not empty requestScope.ModifyDepartment}">
	                        <button class="btn btn-primary" onclick="saveDepartment()">查询</button>                             
	                        <button class="btn btn-default" onclick="cancelSaveDepartment()">取消查询</button>
	                      </c:if>
                      </div>
                    </div>
					</div>
				</div>
				
		
						</form>

				<div class="table-responsive bs-example widget-shadow">
					<h4>登录信息信息表</h4>
				
					
					<div data-example-id="form-validation-states" >
						
							<div class="form-group has-success">
					<div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">批量修改登录类型</label> 
							<ul class="dropdown-menu">
                    <c:forEach items="${loginTypes}" var="loginType">
                      <li><a href="javascript: modifyLoginTypes(${loginType.loginTypeId});">${loginType.loginTypeName}</a></li>
                    </c:forEach>
                    </ul>
							</div>
							
							<div class="form-group has-warning">
								 
									<label class="control-label" for="inputSuccess1">批量修改登录状态</label> 
									    <ul class="dropdown-menu">
                    <c:forEach items="${loginStates}" var="loginState">
                      <li><a href="javascript: modifyLoginStates(${loginState.loginStateId});">${loginState.loginStateName}</a></li>
                    </c:forEach>
                    </ul>

                           </div>
                           <div class="form-group has-error">
								 
									<label class="control-label" for="inputSuccess1">批量修改所属部门</label> 
							<ul class="dropdown-menu">
                    <c:forEach items="${departments}" var="department">
                      <li><a href="javascript: modifyDepartments(${department.departmentId});">${department.departmentName}</a></li>
                    </c:forEach>
                    </ul>
							</div>
                           </div>
							</div>
							
						<thead>
							  <tr>
                        <th nowrap="nowrap"><input type="checkbox" id="chkSelectAll" onclick="selectAll()"></input> 全选</th>
                        <th nowrap="nowrap"><a href="javascript: sorting('Logins.LoginId')">序号</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('LoginName')">登录名</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('Nickname')">昵称</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('Email')">Email</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('LoginTime')">登录数</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('Grade')">等级</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('RegisterDateTime')">注册情况</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('LastLoginDateTime')">最后登录情况</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('LoginStates.LoginStateName')">状态</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('LoginTypes.LoginTypeName')">类型</a></th>
                        <th nowrap="nowrap"><a href="javascript: sorting('Departments.DepartmentName')">部门</a></th>
                        <th nowrap="nowrap">操作</th>
                      </tr>
						</thead>
						 <tbody>
                    <c:forEach items="${logins}" var="login" 
                      begin="${(currentPageIndex - 1) * pageSize}" end="${currentPageIndex * pageSize - 1}">
                      <tr>
                        <td nowrap="nowrap" align="center">
                          <input type="checkbox" id="chkLogin${login.loginId}" name="chkLogins" value="${login.loginId}" />
                        </td>
                        <td nowrap="nowrap">${login.loginId}</td>
                        <td nowrap="nowrap">${login.loginName}</td>
                        <td nowrap="nowrap">${login.nickname}</td>
                        <td nowrap="nowrap">${login.email}</td>
                        <td nowrap="nowrap">${login.loginTime}</td>
                        <td nowrap="nowrap">${login.grade}</td>
                        <td>${login.registerDateTime}<br>${login.registerIp}</td>
                        <td>${login.lastLoginDateTime}<br>${login.lastLoginIp}</td>
                        <td nowrap="nowrap">${login.loginState.loginStateName}</td>
                        <td nowrap="nowrap">${login.loginType.loginTypeName}</td>
                        <td nowrap="nowrap">${login.department.departmentName}</td>
                        <td nowrap="nowrap">
                          <button class="btn btn-xs btn-danger" onclick="removeLogin(${login.loginId})"><i class="icon-remove"></i> </button>
                        </td>
                      </tr>
                    </c:forEach>
                    </tbody>
					</table>
					 <div class="widget-foot">
                  共${rowCount}条数据&nbsp;&nbsp;&nbsp;第${currentPageIndex}/${pageCount}页&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="radPageSize" value="10" onclick="resize(this.value)" <c:if test="${pageSize == 10}">checked</c:if>>10条/页
                    &nbsp;&nbsp;
                    <input type="radio" name="radPageSize" value="20" onclick="resize(this.value)" <c:if test="${pageSize == 20}">checked</c:if>>20条/页
                    &nbsp;&nbsp;
                    <input type="radio" name="radPageSize" value="50" onclick="resize(this.value)" <c:if test="${pageSize == 50}">checked</c:if>>50条/页
                   <ul class="pagination pull-right">
                      <c:if test="${currentPageIndex <= 1}">
                        <li><a>首页</a></li>
                        <li><a>上一页</a></li>
                      </c:if>
                      <c:if test="${currentPageIndex > 1}">
                        <li><a href="javascript: paging(1)">首页</a></li>
                        <li><a href="javascript: paging(${currentPageIndex - 1})">上一页</a></li>
                      </c:if>
                      <c:if test="${currentPageIndex >= pageCount}">
                        <li><a>下一页</a></li>
                        <li><a>尾页</a></li>
                      </c:if>
                      <c:if test="${currentPageIndex < pageCount}">
                        <li><a href="javascript: paging(${currentPageIndex + 1})">下一页</a></li>
                        <li><a href="javascript: paging(${pageCount})">尾页</a></li>
                      </c:if>
                      <li><a href="javascript: removeSelect()">删除选中</a></li>
                    </ul>
                    <div class="clearfix"></div> 
					</div>
				</div>
			</div>
		</div>
	</div>


	<%@include file="/footer.jsp"%>


	<!-- Scroll to top -->
	<span class="totop"><a href="#"><i class="icon-chevron-up"></i>
	</a>
	</span>

	<!--scrolling js-->
	<script src="/EMS/js/jquery.nicescroll.js"></script>
	<script src="/EMS/js/scripts.js"></script>
	<!--//scrolling js-->
	<!-- Bootstrap Core JavaScript -->
	<script src="/EMS/js/bootstrap.js"> </script>
	<script src="/EMS/js/classie.js"></script>

    <script src="/EMS/My97DatePicker/WdatePicker.js"></script> <!-- 时间 -->
    
	<!-- Script for this page -->
	<script type="text/javascript">
	
	
var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
				showLeftPush = document.getElementById( 'showLeftPush' ),
				body = document.body;
				
			showLeftPush.onclick = function() {
				classie.toggle( this, 'active' );
				classie.toggle( body, 'cbp-spmenu-push-toright' );
				classie.toggle( menuLeft, 'cbp-spmenu-open' );
				disableOther( 'showLeftPush' );
			};
			
			function disableOther( button ) {
				if( button !== 'showLeftPush' ) {
					classie.toggle( showLeftPush, 'disabled' );
				}
			}

//验证
function checkInput(){
	var txtDepartmentName = document.getElementById("txtDepartmentName");
	var spanDepartmentName = document.getElementById("spanDepartmentName");
	
	if(txtDepartmentName.value.length == 0){
		spanDepartmentName.innerHTML = "部门名不能为空。";
	    return false;
	}
	else{
		spanDepartmentName.innerHTML="";
		return true;
	}
}
function checkSearch(){
	var txtSearchDepartmentName = document.getElementById("txtSearchDepartmentName");
	var txtSearchAddress = document.getElementById("txtSearchAddress");
	var txtSearchDescription = document.getElementById("txtSearchDescription");
	var spanSearch = document.getElementById("spanSearch");
	
	if(txtSearchDepartmentName.value.length == 0
	&& txtSearchAddress.value.length == 0
	&& txtSearchDescription.value.length == 0){
		spanSearch.innerHTML = "查询条件不能为空。";
		return false;
	}
	else{
		spanSearch.innerHTML="";
		return true;
	}
}
function addDepartment(){
	if (checkInput()){
	  var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");//获取表单
	  
	  hidOperateType.value="add";
	  frmDepartment.submit();
	  
	}
}

function removeDepartment(departmentId){
	if(confirm("确定要删除么？")){
		var frmDepartment = document.getElementById("frmDepartment");
		var hidOperateType = document.getElementById("hidOperateType");
		var hidDepartmentId = document.getElementById("hidDepartmentId");

		hidDepartmentId.value = departmentId;
		hidOperateType.value="remove";
		frmDepartment.submit();
		//alert(departmentId);
	}
}

function modifyDepartment(departmentId){
	var frmDepartment = document.getElementById("frmDepartment");
	var hidOperateType = document.getElementById("hidOperateType");
	var hidDepartmentId = document.getElementById("hidDepartmentId");

	hidDepartmentId.value = departmentId;
	hidOperateType.value="modify";
	frmDepartment.submit();
	//alert(departmentId);
}

function saveDepartment(departmentId){
	if (checkInput()){
		  var frmDepartment = document.getElementById("frmDepartment");
		  var hidOperateType = document.getElementById("hidOperateType");
		  
		  hidOperateType.value="save";
		  frmDepartment.submit();
	}
}

function cancelSaveDepartment(departmentId){
	  var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  
	  hidOperateType.value="cancelSave";
	  frmDepartment.submit();
}

function paging(pageIndex){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var hidCurrentPageIndex = document.getElementById("hidCurrentPageIndex");
	  
	  
	  hidCurrentPageIndex.value=pageIndex;
	  hidOperateType.value = "paging";
	  frmDepartment.submit();
}

function sorting(sortField) {
    var frmDepartment = document.getElementById("frmDepartment");//通过Id获得对应的元素
	var hidOperateType = document.getElementById("hidOperateType");//通过Id获得对应的元素
	var hidSortField = document.getElementById("hidSortField");//通过Id获得对应的元素
	
	hidSortField.value = sortField;
	hidOperateType.value = "sorting";
	frmDepartment.submit();

}

function resize(pageSize){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var hidPageSize = document.getElementById("hidPageSize");
	  
	  
	  hidPageSize.value = pageSize;
	  hidOperateType.value = "resize";
	  frmDepartment.submit();
//	  alart(pageSize)
}

function searchDepartment(){
      if(checkSearch()){
        var frmDepartment = document.getElementById("frmDepartment");
	    var hidOperateType = document.getElementById("hidOperateType");
	    
	    hidOperateType.value = "search";
	    frmDepartment.submit();
	  }
}

function cancelSearchDepartment(){
      var frmDepartment = document.getElementById("frmDepartment");
	  var hidOperateType = document.getElementById("hidOperateType");
	  var txtSearchDepartmentName = document.getElementById("txtSearchDepartmentName");
	  var txtSearchAddress = document.getElementById("txtSearchAddress");
	  var txtSearchDescription = document.getElementById("txtSearchDescription");
	  
	  txtSearchDepartmentName.value = "";
	  txtSearchAddress.value = "";
	  txtSearchDescription.value = "";
	  hidOperateType.value = "cancelSearch";
	  frmDepartment.submit();
}

function myLoad(){
 ${alertMessage}
}
/* Curve chart ends */
</script>

</body>
</html>
